﻿<?php
if(isset($_POST["rid"]))
{
$rid = $_POST["rid"];
$name = $_POST["name"];
$db = mysql_connect("mysql513.in.shared-server.net:16033", "JRtu434", "qvoiceDB1");
 mysql_select_db("JRtu434", $db);
 mysql_query("SET NAMES utf8");
 mysql_query("Update projects set rid=\"".$_POST["rid"]."\", name=\"".$_POST["name"]."\", state=\"".$_POST["state"]."\",
  invites=\"".$_POST["invites"]."\", cpc=\"".$_POST["cpc"]."\", ss=\"".$_POST["ss"]."\", forex=\"".$_POST["forex"]."\", 
  questions=\"".$_POST["questions"]."\", mitsumori=\"".$_POST["mitsumori"]."\", jname=\"".$_POST["jname"]."\", 
  cid=\"".$_POST["cid"]."\", url=\"".$_POST["url"]."\" where ID=\"".$_POST["id"]."\"");
 mysql_close();
 echo "Record ".$_POST["id"]." - ".$_POST["name"]."  has been updated. <br>";
 }
?> 
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
	<script type="text/javascript">
		function showproject(str)
		{
		if (str=="asfd")
		  {
		  document.getElementById("change").innerHTML="";
		  return;
		  }
		if (window.XMLHttpRequest)
		  {// code for IE7+, Firefox, Chrome, Opera, Safari
		  xmlhttp=new XMLHttpRequest();
		  }
		else
		  {// code for IE6, IE5
		  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
		  }
		xmlhttp.onreadystatechange=function()
		  {
		  if (xmlhttp.readyState==4 && xmlhttp.status==200)
		    {
		    document.getElementById("change").innerHTML=xmlhttp.responseText;
		    }
		  }
		 
		xmlhttp.open("GET","dynamic.php?func=3&id="+str,true);
		xmlhttp.send();
		}
		</script>
<title>Project Register</title>
</head>
<body>
<?php include 'layout.php'; ?> 
	<div id="content">
		<?php 
		$data = file_get_contents('http://www.google.com/finance/converter?a=1&from=USD&to=JPY');
		$regex = '/<span class=bld>(.+?) JPY/';
		preg_match($regex,$data,$match); 
		echo "Curent Forex: 1 USD = " . number_format($match[1],2). " JPY";
		?>
		<hr>
		<form method="post" action="<?php echo htmlentities($_SERVER['PHP_SELF']); ?>">
		<div id="change"><?php include "dynamic.php"; if(isset($_POST["id"])) drawbrowser($_POST["id"]); else drawbrowser("1");?></div>
		<b>Remember to use this URL in the POST system: http://www.gain-www.com/redirect/auto_import.php?mid=$mid$&rid=$rid$</b><br>
		<b>If you are using multi URLs, use this: http://www.gain-www.com/redirect/auto_import2.php?mid=$mid$&rid=$rid$</b>
		<hr>
		<?php if(isset($rid)) {
			for ($i=1;$i<11;$i++){
			if($i<=9)
				echo "http://www.gain-www.com/redirect/auto_import.php?mid=test0".$i."&rid=".$_POST["rid"]."<br>";
			else
				echo "http://www.gain-www.com/redirect/auto_import.php?mid=test".$i."&rid=".$_POST["rid"]."<br>";
			}
		}
		?>
	</div>
</body>
</html>
